from common.setting import ensure_path_sep
from utils.mysqlUtils.db_pool import Database

zhcxkj_center_category_db = Database(ensure_path_sep("\\config\\shopeev2_config.yaml.bak"),
                                                          "zhcxkj_center_category_attribute_prod")





class T_sku_category:


    @staticmethod
    def get_other_node_id(platform_type, sku_list):
        sku_other_node_id_dict = {}
        get_data_list_sql = """
                SELECT sku,other_node_id
        FROM zhcxkj_center_category.t_sku_category 
        WHERE 
        platform_type= %s
        AND sku in %s
        AND is_deleted=0
                """
        data_list = zhcxkj_center_category_db.fetch_all_tuple(get_data_list_sql,
                                                                           (platform_type, set(sku_list)))
        if len(data_list):
            sku_other_node_id_dict = {sku:other_node_id for sku, other_node_id in data_list}

        return sku_other_node_id_dict